import React from "react";

export default class Test extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            number: 0
        };
    }
    numberClick=()=>{
        const {number}=this.state
        this.setState({number:number+1})
    }
    componentDidMount() {
        console.log('组件挂载完成')
    }

    componentDidUpdate() {
        console.log('组件更新完成')
    }

    componentWillUnmount() {
        console.log('组件卸载完成')
    }
    render() {
        return (
            <div>
                <h1>class类写法</h1>
                <button onClick={this.numberClick}>{this.state.number}</button>
            </div>
        )
    }
}
